package edu.java.lectures.lec12.threads.synchronization.dynamic.bank;

public class BankAccount {

    private double balance;

    public BankAccount(double balance) {
	this.balance = balance;
    }

    public double getBalance() {
	return balance;
    }

    public void payIn(double amount) {
	System.out.println("Paying in: " + amount);
	balance = balance + amount;
    }

    public synchronized void withdraw(double amount) {
	// System.out.println("Withdrawing: " + amount);
	balance = balance - amount;
	System.out.println("Balance after the withdrawal is: " + getBalance());
    }
}
